package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.DisciplineMapper;
import com.ruoyi.system.domain.Discipline;
import com.ruoyi.system.service.IDisciplineService;

/**
 * 学科Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-03-16
 */
@Service
public class DisciplineServiceImpl implements IDisciplineService 
{
    @Autowired
    private DisciplineMapper disciplineMapper;

    /**
     * 查询学科
     * 
     * @param did 学科主键
     * @return 学科
     */
    @Override
    public Discipline selectDisciplineByDid(Long did)
    {
        return disciplineMapper.selectDisciplineByDid(did);
    }

    /**
     * 查询学科列表
     * 
     * @param discipline 学科
     * @return 学科
     */
    @Override
    public List<Discipline> selectDisciplineList(Discipline discipline)
    {
        return disciplineMapper.selectDisciplineList(discipline);
    }

    /**
     * 新增学科
     * 
     * @param discipline 学科
     * @return 结果
     */
    @Override
    public int insertDiscipline(Discipline discipline)
    {
        discipline.setCreateTime(DateUtils.getNowDate());
        return disciplineMapper.insertDiscipline(discipline);
    }

    /**
     * 修改学科
     * 
     * @param discipline 学科
     * @return 结果
     */
    @Override
    public int updateDiscipline(Discipline discipline)
    {
        return disciplineMapper.updateDiscipline(discipline);
    }

    /**
     * 批量删除学科
     * 
     * @param dids 需要删除的学科主键
     * @return 结果
     */
    @Override
    public int deleteDisciplineByDids(Long[] dids)
    {
        return disciplineMapper.deleteDisciplineByDids(dids);
    }

    /**
     * 删除学科信息
     * 
     * @param did 学科主键
     * @return 结果
     */
    @Override
    public int deleteDisciplineByDid(Long did)
    {
        return disciplineMapper.deleteDisciplineByDid(did);
    }
}
